package edu.cs.usask.ca.silver.plugin.rcp.handlers.select;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.window.Window;
import org.eclipse.ui.handlers.HandlerUtil;

import edu.cs.usask.ca.silver.plugin.rcp.Activator;
import edu.cs.usask.ca.silver.plugin.rcp.dialogs.select.SelectFromProjectTreeDialog;
import edu.cs.usask.ca.silver.plugin.rcp.views.projectviewer.ProjectViewI;

public class SelectFromProjectTreeDialogHandler extends AbstractHandler {

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		ProjectViewI view = (ProjectViewI) HandlerUtil
				.getActiveWorkbenchWindow(event).getActivePage()
				.findView(event.getParameter("projectviewid"));

		SelectFromProjectTreeDialog dialog = new SelectFromProjectTreeDialog(
				Activator.getDefault().getWorkbench()
						.getActiveWorkbenchWindow().getShell(), view);
		dialog.create();
		if (dialog.open() == Window.OK) {

		}
		return null;
	}
}
